home *** CD-ROM | disk | FTP | other *** search
- /* Example01.Plot - Demonstration program for PLPLOT: */
- /* Modified for RexxPlPlot by Glenn M. Lewis - 9/12/89 */
-
- address 'PlPlot'
- say 'Please be patient...'
-
- /* Plots three simple functions, each function occupies a separate page */
-
- do i=1 to 6
- xs.i = i
- ys.i = i * i
- end i
-
- space0 = 0
- mark0 = 0
- space1 = 1500
- mark1 = 1500
-
- /* Ask user to specify the output device */
-
- 'plstar(1,1);'
-
- /* Set up the viewport and window using PLENV. The range in X is */
- /* 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are */
- /* scaled separately (just = 0), and we just draw a labelled */
- /* box (axis = 0). */
-
- 'plenv(0.0,6.0,0.0,30.0,0,0);'
- 'pllab("(x)","(y)","\frPLPLOT Example 1 - y=x\u2");'
-
- /* Plot the data points */
-
- 'plpoin(6,xs,ys,9);'
-
- do i=1 to 60
- x.i = 0.1*i;
- y.i = pow(x.i,2.0);
- end i
-
- /* Draw the line through the data */
-
- 'plline(60,x,y);'
-
- /*======================================================================*/
-
- /* Set up the viewport and window using PLENV. The range in X is */
- /* -2.0 to 10.0, and the range in Y is -0.4 to 2.0. The axes are */
- /* scaled separately (just = 0), and we draw a box with axes */
- /* (axis = 1). */
-
- 'plenv(-2.0,10.0,-0.4,1.2,0,1);'
- 'pllab("(x)","sin(x)/x","\frPLPLOT Example 1 - Sinc Function");'
-
- /* Fill up the arrays */
-
- do i=1 to 100
- x.i = (i-20.0)/6.0
- y.i = 1.0
- if (x.i ~= 0.0) then y.i = sin(x.i)/x.i
- end i
-
- /* Draw the line */
-
- 'plline(100,x,y);'
-
- /*======================================================================*/
-
- /* For the final graph we wish to override the default tick intervals, */
- /* and so do not use PLENV */
-
- 'pladv(0);'
-
- /* Use standard viewport, and define X range from 0 to 360 degrees, */
- /* Y range from -1.2 to 1.2. */
-
- 'plvsta();'
- 'plwind(0.0,360.0,-1.2,1.2);'
-
- /* Draw a box with ticks spaced 30 degrees apart in X, and 0.2 in Y. */
-
- 'plbox("bcnst",30.0,3,"bcnstv",0.2,2);'
-
- /* Superimpose a dashed line grid, with 1.5 mm marks and spaces. */
- /* plstyl expects a pointer!! */
-
- 'plstyl(1, mark1, space1);'
- 'plbox("g",30.0,3,"g",0.2,2);'
- 'plstyl(0, mark0, space0);'
-
- 'pllab("Angle (degrees)","sine","\frPLPLOT Example 1 - Sine function");'
-
- do i=1 to 101
- x.i = 3.6 * (i - 1);
- y.i = sin(x.i*3.141592654/180.0);
- end i
-
- 'plline(101,x,y);'
-
- /* Don't forget to call PLEND to finish off! */
-
- 'plend();'
-
- exit 0
-